//<template>
  <div>
      <p>{{new_info.title}}</p>
      <p>{{new_info.content}}</p>
      <p>{{new_info.stars}}<button @click="click()">点赞</button></p>
      <p>{{new_info.cate}}</p>
      
  </div>
</template>

<script>
import axios from 'axios'
export default {
    data(){
        return{
            new_info:[]
        }
    },
    methods:{
        get_new(){
            axios({
                url:'http://127.0.0.1:8000/app03/getnew/',
                method:'get',
                params:{'id':this.$route.params.id}
            }).then(res=>{
                console.log(res.data)
                this.new_info = res.data
            })
        },
        click(){
            axios({
                url:'http://127.0.0.1:8000/app03/starsad/',
                method:'get',
                params:{'id':this.$route.params.id}
            }).then(res=>{
                console.log(res.data)
                this.get_new()
            })
        }
    },
    created(){
        this.get_new()
    }
}
</script>

<style>

</style>